Updates from Acepe session#213
Conversation
…ooling Show the thinking header while streaming, wire token reveal into thought groups, and restore TOKEN_REVEAL_STEP_MS so main-body text cascades smoothly again. Extend the dead-code analyzer with export-barrel-only detection and an opt-in apply script for high-confidence deletions. Co-authored-by: Cursor <cursoragent@cursor.com>
There was a problem hiding this comment.
2 issues found across 39 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="scripts/dead-code/apply-dead-code.ts">
<violation number="1" location="scripts/dead-code/apply-dead-code.ts:22">
P2: `--root` parsing consumes the next token even when it is another flag. Missing root value can silently disable `--apply`/other flags and point analysis at an invalid path.</violation>
</file>
<file name="package.json">
<violation number="1" location="package.json:17">
P2: Misleading name: `dead-code:apply` does a dry-run, not an apply. Rename to signal dry-run behavior (e.g. `dead-code:dry-run`) and reserve `dead-code:apply` for the actual deletion.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| for (let index = 0; index < argv.length; index += 1) { | ||
| const arg = argv[index]; | ||
| if (arg === "--root") { | ||
| repoRoot = argv[index + 1] ?? repoRoot; |
There was a problem hiding this comment.
P2: --root parsing consumes the next token even when it is another flag. Missing root value can silently disable --apply/other flags and point analysis at an invalid path.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At scripts/dead-code/apply-dead-code.ts, line 22:
<comment>`--root` parsing consumes the next token even when it is another flag. Missing root value can silently disable `--apply`/other flags and point analysis at an invalid path.</comment>
<file context>
@@ -0,0 +1,109 @@
+ for (let index = 0; index < argv.length; index += 1) {
+ const arg = argv[index];
+ if (arg === "--root") {
+ repoRoot = argv[index + 1] ?? repoRoot;
+ index += 1;
+ continue;
</file context>
| "scripts": { | ||
| "audit": "bun audit --audit-level high", | ||
| "check:dead-code": "bun scripts/dead-code/find-dead-code.ts --strict", | ||
| "dead-code:apply": "bun scripts/dead-code/apply-dead-code.ts", |
There was a problem hiding this comment.
P2: Misleading name: dead-code:apply does a dry-run, not an apply. Rename to signal dry-run behavior (e.g. dead-code:dry-run) and reserve dead-code:apply for the actual deletion.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At package.json, line 17:
<comment>Misleading name: `dead-code:apply` does a dry-run, not an apply. Rename to signal dry-run behavior (e.g. `dead-code:dry-run`) and reserve `dead-code:apply` for the actual deletion.</comment>
<file context>
@@ -14,6 +14,8 @@
"scripts": {
"audit": "bun audit --audit-level high",
"check:dead-code": "bun scripts/dead-code/find-dead-code.ts --strict",
+ "dead-code:apply": "bun scripts/dead-code/apply-dead-code.ts",
+ "dead-code:apply:force": "bun scripts/dead-code/apply-dead-code.ts --apply",
"test": "bun scripts/forbid-structural-tests.ts packages && bun run --cwd packages/ui test && bun run --cwd packages/desktop test && bun run --cwd packages/website test"
</file context>
|
| Filename | Overview |
|---|---|
| scripts/dead-code/find-dead-code.ts | Adds export-barrel-only candidate detection via barrel re-export tracing. One dead branch in resolveReexportTarget (both arms return the same value) may over-populate barrelConsumed and hide valid candidates; separately, dead regex code in parseImportNames after an earlier continue guard. |
| scripts/dead-code/apply-dead-code.ts | New dry-run/apply CLI for dead-code deletion. Safe default (dry-run) and opt-in --apply guard; unlinkSync is properly scoped to repo-relative resolved paths. |
| packages/desktop/src-tauri/src/acp/commands/session_commands/new_session.rs | Adds require_creation_attempt_for_deferred_bind to fail-closed when a deferred bind's creation row is missing, replacing a silent Option unwrap with a proper error. Tests cover both the happy path and the missing-attempt case. |
| packages/desktop/src-tauri/src/acp/client/cc_sdk_client/mod.rs | Clears pending_model_id when the capability catalog is empty, preventing a stale model from persisting across reconnects. Test coverage added. |
| packages/desktop/src/lib/acp/store/session-sequence-id-backfill.ts | New utility that resolves the sequence ID backfill priority: metadata wins, then graph, then pending creation. Logic is simple and well-tested. |
| packages/desktop/src/lib/acp/store/session-open-snapshot-applier.svelte.ts | Adds syncSessionSequenceFromPendingCreation called before completePendingCreation, ensuring the sequence ID is backfilled from either the graph or pending creation before the pending state is cleared. |
| packages/ui/src/components/agent-panel/agent-assistant-message.svelte | Refactors thinking-block collapse to use a derived isCollapsed driven by streaming state, and shows the Thinking header unconditionally while streaming. Token-reveal timing is now applied to the last thought group during streaming. |
| packages/desktop/src/lib/acp/components/agent-panel/logic/agent-panel-header-sequence-id.ts | New logic function resolving panel header sequence ID from metadata, falling back to pending creation sequence when metadata isn't yet populated. |
| packages/desktop/src/lib/acp/components/messages/assistant-message.svelte | Deleted (dead code cleanup) — replaced by the shared component in packages/ui. |
Sequence Diagram
%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
participant Panel as agent-panel.svelte
participant Store as SessionStore
participant Facade as SessionConnectionFacade
participant Coord as SessionCreationCoordinator
participant Applier as SessionOpenSnapshotApplier
participant Backfill as session-sequence-id-backfill
Note over Panel,Coord: Before session metadata arrives (pending state)
Panel->>Store: getPendingCreationSession(id)
Store->>Facade: getPendingCreationSession(id)
Facade->>Coord: getPendingCreation(id)
Coord-->>Panel: "{ sequenceId: N }"
Panel->>Panel: resolveAgentPanelHeaderSequenceId()
Note over Applier,Backfill: On snapshot open (session connects)
Applier->>Applier: syncSessionSequenceFromGraph(graph)
Applier->>Backfill: resolveSequenceIdBackfillForExistingSession()
Backfill-->>Applier: graphSequenceId ?? pendingSequenceId
Applier->>Store: "updateSession(sessionId, { sequenceId })"
Applier->>Coord: completePendingCreation(sessionId)
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
participant Panel as agent-panel.svelte
participant Store as SessionStore
participant Facade as SessionConnectionFacade
participant Coord as SessionCreationCoordinator
participant Applier as SessionOpenSnapshotApplier
participant Backfill as session-sequence-id-backfill
Note over Panel,Coord: Before session metadata arrives (pending state)
Panel->>Store: getPendingCreationSession(id)
Store->>Facade: getPendingCreationSession(id)
Facade->>Coord: getPendingCreation(id)
Coord-->>Panel: "{ sequenceId: N }"
Panel->>Panel: resolveAgentPanelHeaderSequenceId()
Note over Applier,Backfill: On snapshot open (session connects)
Applier->>Applier: syncSessionSequenceFromGraph(graph)
Applier->>Backfill: resolveSequenceIdBackfillForExistingSession()
Backfill-->>Applier: graphSequenceId ?? pendingSequenceId
Applier->>Store: "updateSession(sessionId, { sequenceId })"
Applier->>Coord: completePendingCreation(sessionId)
Reviews (2): Last reviewed commit: "chore(dead-code): track barrel named imp..." | Re-trigger Greptile
| const pendingCreation = sessionStore.getPendingCreationSession(id); | ||
| return resolveAgentPanelHeaderSequenceId({ | ||
| sessionMetadataSequenceId: sessionController.sessionMetadata?.sequenceId, | ||
| pendingCreationSequenceId: pendingCreation?.sequenceId ?? null, | ||
| hasPendingCreationSession: sessionStore.hasPendingCreationSession(id), | ||
| }); |
There was a problem hiding this comment.
getPendingCreationSession(id) already returns null when there is no pending creation, so calling hasPendingCreationSession(id) separately is redundant — pendingCreation !== null is the exact same check. The two calls also go through separate delegation chains, making them subtly susceptible to diverging if the underlying map is mutated between them.
| const pendingCreation = sessionStore.getPendingCreationSession(id); | |
| return resolveAgentPanelHeaderSequenceId({ | |
| sessionMetadataSequenceId: sessionController.sessionMetadata?.sequenceId, | |
| pendingCreationSequenceId: pendingCreation?.sequenceId ?? null, | |
| hasPendingCreationSession: sessionStore.hasPendingCreationSession(id), | |
| }); | |
| const pendingCreation = sessionStore.getPendingCreationSession(id); | |
| return resolveAgentPanelHeaderSequenceId({ | |
| sessionMetadataSequenceId: sessionController.sessionMetadata?.sequenceId, | |
| pendingCreationSequenceId: pendingCreation?.sequenceId ?? null, | |
| hasPendingCreationSession: pendingCreation !== null, | |
| }); |
Resolve export-barrel-only false positives by following named imports through re-export chains, delete the unreachable slash-command section component, and remove the superseded desktop AssistantMessage renderer from the messages barrel. Co-authored-by: Cursor <cursoragent@cursor.com>
There was a problem hiding this comment.
1 issue found across 9 files (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="scripts/dead-code/find-dead-code.ts">
<violation number="1" location="scripts/dead-code/find-dead-code.ts:947">
P2: Aliased named imports are resolved with the local alias instead of the exported symbol name. This undercounts barrel consumption and can produce false dead-code classifications.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| const token = typePrefix !== null ? typePrefix[1] ?? "" : trimmed; | ||
| const asIndex = token.lastIndexOf(" as "); | ||
| if (asIndex !== -1) { | ||
| names.push(token.slice(asIndex + 4).trim()); |
There was a problem hiding this comment.
P2: Aliased named imports are resolved with the local alias instead of the exported symbol name. This undercounts barrel consumption and can produce false dead-code classifications.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At scripts/dead-code/find-dead-code.ts, line 947:
<comment>Aliased named imports are resolved with the local alias instead of the exported symbol name. This undercounts barrel consumption and can produce false dead-code classifications.</comment>
<file context>
@@ -899,6 +899,267 @@ export function parseGitPorcelain(output: string): Candidate[] {
+ const token = typePrefix !== null ? typePrefix[1] ?? "" : trimmed;
+ const asIndex = token.lastIndexOf(" as ");
+ if (asIndex !== -1) {
+ names.push(token.slice(asIndex + 4).trim());
+ } else {
+ names.push(token.trim());
</file context>
| names.push(token.slice(asIndex + 4).trim()); | |
| names.push(token.slice(0, asIndex).trim()); |
Summary by cubic
Polishes the assistant Thinking experience with a streaming header and smoother token reveal, stabilizes first‑connect session identity/sequence, and upgrades dead‑code tooling for safer cleanup. Also removes orphan UI renderers and fixes pending model/deferred bind edge cases.
New Features
TOKEN_REVEAL_STEP_MSto 48ms (packages/ui,packages/desktop).resolveResolvableToolbarModelId, and use it in the composer toolbar (packages/desktop).session-sequence-id-backfill, store/applier updates).scripts/dead-code/apply-dead-code.tswith dry‑run and--apply(delete) modes plus optional--include-barrel-only; detectexport-barrel-onlyby following named imports through re‑export chains; remove unusedagent-input-slash-command-section.svelteand the legacy desktopAssistantMessageexport.Bug Fixes
pending_model_idwhen the capability catalog is empty in thecc_sdk_client; adds test coverage.require_creation_attempt_for_deferred_bind; adds tests.Written for commit 7ec96dc. Summary will update on new commits.